<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>二维码解析工具</title>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <script src="../js/lib/qrcode.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.js"></script>
</head>
<body>
    <div class="container">
        <div class="header">
            <a href="index.html" class="back-button">
                <i class="fas fa-arrow-left"></i>
            </a>
            <h2>二维码解析工具</h2>
        </div>

        <div class="decode-section">
            <h3>图片解析</h3>
            <div class="input-area">
                <input type="file" id="fileInput" accept="image/*">
                <label for="fileInput" class="upload-btn">
                    <i class="fas fa-upload"></i> 上传图片
                </label>
            </div>
            <img id="preview" style="display: none;">
            <div class="result" id="imageResult"></div>
        </div>

        <div class="decode-section">
            <h3>摄像头扫描</h3>
            <div class="button-group">
                <button onclick="startCamera()">开启摄像头</button>
                <button onclick="stopCamera()">关闭摄像头</button>
            </div>
            <video id="video" playsinline></video>
            <canvas id="canvas" style="display: none;"></canvas>
            <div class="result" id="cameraResult"></div>
        </div>

        <div id="toast" class="toast">操作成功</div>
    </div>
    <script src="../js/qrdecode.js"></script>
</body>
</html> 